/**
 * 
 */
package info.niwota.fwrite;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuInflater;
import android.view.View;

/**
 * @author qiangli
 *
 */
public class TabDayActivity extends Activity {

	private static final String TAG = "TabDayActivity";

	private static final int DIALOG_ACTIONS = 2;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	
		if (Debug.DEBUG) {
			Log.d(TAG, "onCreate: "  + savedInstanceState);
		}
		
		//initActionsMenu(savedInstanceState);
	}
	
	@Override
	protected void onPause() {
		super.onPause();
		if (Debug.DEBUG) {
			Log.d(TAG, "onPause");
		}
	}

	@Override
	protected void onResume() {
		super.onResume();
		
		if (Debug.DEBUG) {
			Log.d(TAG, "onResume");
		}
	}

	@Override
	protected void onStart() {
		super.onStart();
		if (Debug.DEBUG) {
			Log.d(TAG, "onStart");
		}
	}

	@Override
	public void onStop() {
		super.onStop();
		if (Debug.DEBUG) {
			Log.d(TAG, "onStop");
		}
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		//
		if (Debug.DEBUG) {
			Log.d(TAG, "onDestroy");
		}
	}
	
	@Override
	public void onCreateContextMenu(ContextMenu menu, View v,
			ContextMenuInfo menuInfo) {
		if (Debug.DEBUG) {
			Log.d(TAG, "onCreateContextMenu " + v);
		}
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.note_list_context, menu);
	}

//	@Override
//	public void doSingleTap(long startMillis, long endMillis) {
//		if (Debug.DEBUG) {
//			Log.d(TAG, "start: " + new Date(startMillis) + " end: " + new Date(endMillis));
//		}
//	}
	
	private Dialog createActionsDialog() {
		return MenuDialogs.createMenuDialog(this, R.string.action_menu,
				new MenuCallback() {
					public void perform(MenuInfo mi) {
						switch (mi.getId()) {
						case R.string.action_top:
							//doShowTop();
							break;
						case R.string.action_compose:
							//doCompose();
							break;
						case R.string.action_sessions:
							//doListSessions();
							break;
						case R.string.action_peers:
							//doPickPeer();
							break;
						case R.string.action_archive:
							//doViewArchive();
							break;
						default:
						}
					}
				});
	}

	@Override
	protected void onPrepareDialog(int id, Dialog dialog) {
		Issues.fixIssue3674(dialog.getWindow());
		super.onPrepareDialog(id, dialog);
	}

	@Override
	protected Dialog onCreateDialog(int id) {
		switch (id) {
		case DIALOG_ACTIONS:
			return createActionsDialog();
		default:
		}
		return super.onCreateDialog(id);
	}
	
//	@Override
//	protected void showActionsMenu() {
//		showDialog(DIALOG_ACTIONS);
//	}
}
